package com.zeng.sys.filemd.servicemodule.wrapperImpl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zeng.nicecore.wrapper.AbstractWrapperBuilder;
import com.zeng.sys.filemd.servicemodule.entity.FileServer;
import com.zeng.sys.filemd.servicemodule.vo.FileServerVo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.CollectionUtils;

public class FileServerWrapper implements AbstractWrapperBuilder<FileServerVo, FileServer> {

    @Override
    public void wrapperHandle(QueryWrapper wrapper, FileServerVo fileServerVo) {
        wrapper.like(StringUtils.isNotEmpty(fileServerVo.getName()),
                FileServer.Fields.name,
                fileServerVo.getName());
        wrapper.like(StringUtils.isNotEmpty(fileServerVo.getFlag()),
                FileServer.Fields.flag,
                fileServerVo.getFlag());

        wrapper.in(!CollectionUtils.isEmpty(fileServerVo.getCodes()), "code", fileServerVo.getCodes());

    }
}
